<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" >
<head>
	<th:block th:include="include :: header('新增主持人')" />
</head>
<body class="white-bg">
	<div class="wrapper wrapper-content animated fadeInRight ibox-content">
		<form class="form-horizontal m" id="form-order-add">
			<div class="form-group">
				<label class="col-sm-3 control-label">下单人姓名：</label>
				<div class="col-sm-8">
					<input class="form-control" type="text" name="orderCustomerName" id="orderCustomerName" required>
				</div>
			</div>
			<div class="form-group">
				<label class="col-sm-3 control-label ">下单人电话：</label>
				<div class="col-sm-8">
					<input class="form-control" type="text" name="orderPhone" id="orderPhone" required>
				</div>
			</div>
			<div class="form-group">
				<label class="col-sm-3 control-label">下单公司：</label>
				<div class="col-sm-8">
					<input class="form-control" type="text" name="orderCompany" id="orderCompany" required>
				</div>
			</div>
			<div class="form-group">
				<label class="col-sm-3 control-label">主持人：</label>
				<div class="col-sm-8">
					<input class="form-control" type="text" name="orderHostname" id="orderHostname" required>
				</div>
			</div>
			<div class="form-group">
				<label class="col-sm-3 control-label">酒店名称地址：</label>
				<div class="col-sm-8">
					<input class="form-control" type="text" name="orderHotel" id="orderHotel" required>
				</div>
			</div>
			
			<div class="form-group">
				<label class="col-sm-3 control-label">典礼日期：</label>
				<div class="col-sm-8">
<!--					<li class="select-time">-->
						<input type="text" class="time-input" id="orderCeremonydatestart" placeholder="开始时间" name="orderCeremonydatestart"/>
						<span>--</span>
						<input type="text" class="time-input" id="orderCeremonydatestop" placeholder="结束时间" name="orderCeremonydatestop"/>
<!--					</li>-->
				</div>
			</div>
			<div class="form-group">
				<label class="col-sm-3 control-label">典礼时间：</label>
				<div class="col-sm-8">
					<input class="form-control" type="text" name="orderCeremonytime" id="orderCeremonytime" placeholder="（0全天,1上午,2下午）请填写0,1,2" required>
				</div>
			</div>
			
			<div class="form-group">
				<label class="col-sm-3 control-label">金额：</label>
				<div class="col-sm-8">
					<input class="form-control" type="text" name="orderPrice" id="orderPrice" required>
				</div>
			</div>


		</form>
	</div>
	<th:block th:include="include :: footer" />
	<script type="text/javascript">
		var prefix = ctx + "user/order";
	    
		$("#form-order-add").validate({
			onkeyup: false,
			rules:{
				orderCustomerName:{
					remote: {
						url: prefix +"/checkName",
						type: "post",
						dataType: "json",
						data: {
							"orderCustomerName" : function() {
								return $.common.trim($("#orderCustomerName").val());
							}
						},
						dataFilter: function(data, type) {
							return !($.validate.unique(data));
						}
					}
				},
				orderHostname:{
					remote: {
						url: prefix +"/checkHostname",
						type: "post",
						dataType: "json",
						data: {
							"orderHostname" : function() {
								return $.common.trim($("#orderHostname").val());
							}
						},
						dataFilter: function(data, type) {
							return !($.validate.unique(data));
						}
					}
				},
				orderCompany:{
					remote: {
						url: prefix +"/checkCompany",
						type: "post",
						dataType: "json",
						data: {
							"orderCompany" : function() {
								return $.common.trim($("#orderCompany").val());
							}
						},
						dataFilter: function(data, type) {
							return !($.validate.unique(data));
						}
					}
				},
				orderPhone:{
					remote: {
						url: prefix +"/checkPhone",
						type: "post",
						dataType: "json",
						data: {
							"orderPhone" : function() {
								return $.common.trim($("#orderPhone").val());
							},
							"orderCustomerName" : function() {
								return $.common.trim($("#orderCustomerName").val());
							}
						},
						dataFilter: function(data, type) {
							return !($.validate.unique(data));
						}
					}
				},
				orderCeremonytime:{
					remote: {
						url: prefix +"/checkCeremonytime",
						type: "post",
						dataType: "json",
						data: {
							"orderCeremonytime" : function() {
								return $.common.trim($("#orderCeremonytime").val());
							},
							"orderHostname" : function() {
								return $.common.trim($("#orderHostname").val());
							},
							"orderCeremonydatestart" : function() {
								return $.common.trim($("#orderCeremonydatestart").val());
							}
						},
						dataFilter: function(data, type) {
							return !($.validate.unique(data));
						}
					}
				},
				postSort:{
					digits:true
				},
			},
			messages: {//1生效
				"orderCustomerName": {
					remote: "用户不存在"
				},
				"orderCompany": {
					remote: "公司不存在"
				},
				"orderPhone": {
					remote: "手机号与用户不匹配"
				},
				"orderHostname": {
					remote: "主持人不存在"
				},
				"orderCeremonytime": {
					remote: "主持人有活动"
				}
			},
		});
		
		function submitHandler() {
	        if ($.validate.form()) {
	        	$.operate.save(prefix + "/add", $('#form-order-add').serialize());
	        }
	    }
	</script>
</body>
</html>
